home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 25 / AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso / Updates / AmigaOS3.5 / IPop / arexx.c < prev    next >
C/C++ Source or Header  |  2000-05-16  |  2KB  |  103 lines

  1. #ifndef __COMMON_H__
  2. #include "common.h"
  3. #endif /* __COMMON_H__ */
  4.  
  5. #ifndef __AREXX_CMDS_H__
  6. #include "arexx_cmds.h"
  7. #endif /* __AREXX_CMDS_H__ */
  8.  
  9. extern BOOL running;
  10. extern struct PopData *pd;
  11.  
  12. BOOL initARexx(struct PopData *pd)
  13. {
  14.    BOOL result = FALSE;
  15.  
  16.    if(pd->pd_ARexx = ARexxObject,
  17.       AREXX_HostName, pd->pd_ARexxPort ? pd->pd_ARexxPort : (UBYTE*)"IPOP.1",
  18.       AREXX_Commands, ARexxCommands,
  19.       AREXX_NoSlot, TRUE,
  20.    End)
  21.    {
  22.       GetAttr(AREXX_SigMask, pd->pd_ARexx, &pd->pd_rexxSigBit);
  23.       result = TRUE;
  24.    }
  25.    else
  26.    {
  27.       char buffer[64];
  28.  
  29.       sprintf(buffer, "ARexx port %s already exists", pd->pd_ARexxPort);
  30.       requestUser(buffer);
  31.    }
  32.    return(result);
  33. }
  34.  
  35. /*****************************************************************************/
  36.  
  37. VOID disposeARexx(struct PopData *pd)
  38. {
  39.    if(pd->pd_ARexx)
  40.    {
  41.       DisposeObject(pd->pd_ARexx);
  42.    }
  43. }
  44.  
  45. VOID __saveds __asm rexx_Check(register __a0 struct ARexxCmd *ac, register __a1 struct RexxMsg *rm)
  46. {
  47.    if(ac->ac_ArgList[0])
  48.    {
  49.       pd->pd_Check = *((LONG*)ac->ac_ArgList[0]) * 60;
  50.       AbortIO((struct IORequest*)pd->pd_TimeRequest);
  51.       WaitIO((struct IORequest*)pd->pd_TimeRequest);
  52.  
  53.       pd->pd_TimeRequest->tr_node.io_Command = TR_ADDREQUEST;
  54.       pd->pd_TimeRequest->tr_time.tv_secs = pd->pd_Check * 60;
  55.       pd->pd_TimeRequest->tr_time.tv_micro = 0;
  56.       SendIO((struct IORequest*)pd->pd_TimeRequest);
  57.  
  58.    }
  59.    else
  60.    {
  61.       doPop(pd);
  62.    }
  63.    ac->ac_Result = "1";
  64. }
  65.  
  66. VOID __saveds __asm rexx_Quiet(register __a0 struct ARexxCmd *ac, register __a1 struct RexxMsg *rm)
  67. {
  68.    if(pd->pd_Quiet)
  69.    {
  70.       pd->pd_Quiet = FALSE;
  71.       ac->ac_Result = "0";
  72.    }
  73.    else
  74.    {
  75.       pd->pd_Quiet = TRUE;
  76.       ac->ac_Result = "1";
  77.    }
  78. }
  79.  
  80. VOID __saveds __asm rexx_Version(register __a0 struct ARexxCmd *ac, register __a1 struct RexxMsg *rm)
  81. {
  82.    ac->ac_Result = VERS;
  83. }
  84.  
  85. VOID __saveds __asm rexx_Quit(register __a0 struct ARexxCmd *ac, register __a1 struct RexxMsg *rm)
  86. {
  87.    running = FALSE;
  88.    ac->ac_Result = "1";
  89. }
  90.  
  91. VOID __saveds __asm rexx_Author(register __a0 struct ARexxCmd *ac, register __a1 struct RexxMsg *rm)
  92. {
  93.    ac->ac_Result = AUTHOR;
  94. }
  95.  
  96. VOID __saveds __asm rexx_Waiting(register __a0 struct ARexxCmd *ac, register __a1 struct RexxMsg *rm)
  97. {
  98.    static UBYTE buffer[5];
  99.  
  100.    sprintf(buffer, "%ld", pd->pd_TotalMsg);
  101.    ac->ac_Result = buffer;
  102. }
  103.